﻿

using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using SharedResources.View;

namespace SharedResources.ViewModel
{
    public class PopUpProgressBarViewModel : BaseViewModel
    {
        private PopUpProgressBar _popUpProgressBar;

        public void Show(PopUpProgressBarViewModel context, string title = "")
        {
            _popUpProgressBar = new PopUpProgressBar {DataContext = context, Topmost = true};
            _popUpProgressBar.MouseLeave += ((sender, args) => _popUpProgressBar.Topmost = false);
            _popUpProgressBar.Show();
            if(title.Equals("") == false)
            {
                Title = title;
                _popUpProgressBar.Title = title;
                OnPropertyChanged("Title");
            }
        }

        public void ClosePopUp()
        {
            _popUpProgressBar.Close();
        }

        public string Title { get; set; }

        private string _details;
        public string Details
        {
            get { return _details; }
            set 
            {
                if (_details == value) return;
                _details = value;
                OnPropertyChanged("Details");
            }
        }

        private int _progresser;
        public int Progresser
        {
            get { return _progresser; }
            set
            {
                if (_progresser == value) return;
                _progresser = value;
                OnPropertyChanged("Progresser");
            }
        }
        
    }
}
